package com.ado.bazinga.core.manager.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ado.bazinga.core.dal.dao.AdminMapper;
import com.ado.bazinga.core.dal.entity.Admin;
import com.ado.bazinga.core.manager.AdminManager;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 *@author adonais
 *@date 2020年3月20日
 *@description AdminManagerImpl.java
**/
@Service(value = "adminManager")
public class AdminManagerImpl extends ServiceImpl<AdminMapper, Admin> implements AdminManager{
	
	@Autowired
	private AdminMapper adminMapper ;

	@Override
	public Admin findById(String userId) {
		return adminMapper.selectByPrimaryKey(Integer.valueOf(userId));
	}

	@Override
	public List<Admin> findAll() {
		return adminMapper.findAll();
	}

	@Override
	public Admin findByAccount(String account) {
		return adminMapper.findByAccount(account);
	}

	@Override
	public boolean insertAdmin(Admin admin) {
		boolean flag = false ;
		int result = adminMapper.insertSelective(admin) ;
		if(result != 0) {
			flag = true ;
		}
		return flag;
	}

}
